#ifndef DW_GRAPHICS_OPENGL_210_BACKEND_H
#	define DW_GRAPHICS_OPENGL_210_BACKEND_H

#if (DW_GRAPHICS_BACKEND != DW_GRAPHICS_BACKEND_OPENGL_210)
#	error "Invalid included file"
#endif // (DW_GRAPHICS_BACKEND != DW_GRAPHICS_BACKEND_OPENGL_210)

#include "graphics/opengl/210/contextsetup.h"
#include "graphics/opengl/210/context.h"
#include "graphics/opengl/210/renderwindow.h"

namespace dw {
	namespace graphics {

		class RenderTarget;
		class Viewport;

		namespace details {

class Backend
{
public :
	typedef dw::graphics::details::ContextSetup ContextSetup;
	typedef dw::graphics::details::Context Context;
	typedef dw::graphics::details::RenderWindow RenderWindow;

public :
	Backend();
	~Backend();

public :
	void initilize(const ContextSetup& setup);
	void terminate();

public :
	void setContext(Context* context);
	void setRenderTarget(RenderTarget* renderTarget);
	void setViewport(Viewport* viewport);
	void clearRenderTarget();
	void present();

	RenderWindow* createRenderWindow();

public :
	bool isValid() const ;

private :
	Context* createMainContext(const ContextSetup& setup);

private :
	Context* m_mainContext;
	Context* m_context;

	bool m_glewIsInitialized;

	RenderTarget* m_renderTarget;
	Viewport* m_viewport;
};

		} // namespace details
	} // namespace graphics
} // namespace dw

#include "graphics/opengl/210/backend.inl"

#endif // !DW_GRAPHICS_OPENGL_210_BACKEND_H
